package com.mj.scence.area
{
	import com.mj.model.MjModel;
	import com.mj.scence.area.view.AreaScenceV;
	import com.mj.vo.AreaData;
	
	import flash.events.Event;
	
	import resLib.version.VersionManager;

	public class AreaScence
	{
		private var areaView:AreaScenceV;
		private var model:MjModel;
		
		public function AreaScence()
		{
			areaView = new AreaScenceV();
			model = MjModel.I;
			model.connect(onConnect);
		}
		
		private function onConnect(evt:Event):void
		{
			//01000000000000000000000000000000
			model.loginGame(VersionManager.versionFileData.testUserId, "11", onAreaInfo);//
			
		}
		
		private function onAreaInfo($data:Vector.<AreaData>):void
		{
			var i:uint = 0;
			while(i<$data.length)
			{
				areaView.addArea($data[i], i);
				i++;
			}
		}
		
		public function get view():AreaScenceV
		{
			return areaView;
		}
	}
}